# Maintainer: kpcyrd <kpcyrd[at]archlinux[dot]org>

pkgname=ldproxy
pkgver=0.3.3
pkgrel=2
pkgdesc="A linker proxy tool"
url='https://github.com/esp-rs/embuild'
arch=('loong64' 'x86_64')
license=('MIT' 'Apache-2.0')
depends=('gcc-libs')
makedepends=('cargo')
source=(https://github.com/esp-rs/embuild/archive/${pkgname}-v${pkgver}/${pkgname}-${pkgver}.tar.gz
        Cargo.lock)
sha256sums=('da159083ee9cd0de1fb197b38336d44463d2c93a6bd8ee218cf28fd052a2a4a7'
            'dbe93d2078a5ea91d6ddd9f51d6c99330525a9bf63f880d87cdfa7fadd8320b6')
b2sums=('d8571ddf5ab3684206e4802871aedea216f6edc978adcb80b7879e58aa01d564634ec654f62eaf401ef1992c48d1cbf8b0b7d7b4cfafb5b2d7e36e3b4d7c22c2'
        'b18ffc65b6632e1b19b028c8be675b76abee0c0068690dd463aef5dd0fcf3a5dc0400db9fc48d9edea0d4b5f88b2990e50aa8f062dcbdd4993ae59d87c3b732f')

prepare() {
  cd "embuild-${pkgname}-v${pkgver}/${pkgname}"
  cp ../../Cargo.lock ..
  cargo fetch --locked --target "$CARCH-unknown-linux-gnu"
}

updlockfiles() {
  cd "embuild-${pkgname}-v${pkgver}"
  rm -f Cargo.lock
  cargo update
  cp Cargo.lock "${outdir}/"
}

build() {
  cd "embuild-${pkgname}-v${pkgver}/${pkgname}"
  cargo build --frozen --release
}

check() {
  cd "embuild-${pkgname}-v${pkgver}/${pkgname}"
  cargo test --frozen
}

package() {
  cd "embuild-${pkgname}-v${pkgver}"
  install -Dm 755 -t "${pkgdir}/usr/bin" \
    target/release/${pkgname}
}

# vim: ts=2 sw=2 et:
